#!/usr/bin/env python
# -- coding: utf-8 --
# @Time : 2023/1/19 16:45
# @Coder: Pithon
# @IDE : PyCharm
# @WEB : http://pithon.top
# ==============================
import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
# options.binary_location = r"C:\Users\ex_yanpsh\AppData\Roaming\360ent\Application\360ent.exe"
options.add_argument('ignore-certificate-errors')
options.add_argument('--disable-blink-features=AutomationControlled')
# options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.maximize_window()


def download_webm(industry, year, month):
    print(f'正在下载{industry}_rank_bar_{year}{month}')
    filename = 'file://' + os.getcwd().replace('\\', '/') + '/' + f'charts/{industry}/rank_bar_{year}{month}.html'
    driver.get(filename)
    time.sleep(32)
    v = driver.find_element(By.TAG_NAME, 'video')
    print(v)
